<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <title>Introduction - Zend Framework Manual</title>

    <link href="../css/shCore.css" rel="stylesheet" type="text/css" />
    <link href="../css/shThemeDefault.css" rel="stylesheet" type="text/css" />
    <link href="../css/styles.css" media="all" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Zend Framework</h1>
<h2>Programmer's Reference Guide</h2>
<ul>
    <li><a href="../en/zend.timesync.introduction.html">Inglês (English)</a></li>
    <li><a href="../pt-br/zend.timesync.introduction.html">Português Brasileiro (Brazilian Portuguese)</a></li>
</ul>
<table width="100%">
    <tr valign="top">
        <td width="85%">
            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="zend.timesync.html">Zend_TimeSync</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="zend.timesync.html">Zend_TimeSync</a></span><br />
                        <span class="home"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="zend.timesync.working.html">Working with Zend_TimeSync</a></div>
                    </td>
                </tr>
            </table>
<hr />
<div id="zend.timesync.introduction" class="section"><div class="info"><h1 class="title">Introduction</h1></div>
    

    <p class="para">
        <span class="classname">Zend_TimeSync</span> is able to receive internet or network time from a time
        server using the <em class="emphasis">NTP</em> or <em class="emphasis">SNTP</em> protocol.
        With <span class="classname">Zend_TimeSync</span>, Zend Framework is able to act independently from
        the time settings of the server where it is running.
    </p>

    <p class="para">
        To be independent from the actual time of the server, <span class="classname">Zend_TimeSync</span>
        works with the difference of the real time which is sent through NTP or SNTP and the
        internal server&#039;s time.
    </p>

    <blockquote class="note"><p><b class="note">Note</b>: <span class="info"><b>Background</b><br /></span>
        

        <p class="para">
            <span class="classname">Zend_TimeSync</span> is not able to change the server&#039;s time, but it
            will return a <a href="zend.date.introduction.html" class="link">Zend_Date</a> instance from
            which the difference from the server&#039;s time can be worked with.
        </p>
    </p></blockquote>

    <div class="section" id="zend.timesync.introduction.why"><div class="info"><h1 class="title">Why Zend_TimeSync ?</h1></div>
        

        <p class="para">
            So why would someone use <span class="classname">Zend_TimeSync</span> ?
        </p>

        <p class="para">
            Normally every server within a multi-server farm will have a service running which
            synchronizes its own time with a time server. So within a standard environment it should
            not be necessary to use <span class="classname">Zend_TimeSync</span>. But it can become handy if
            there is no service available and if you don&#039;t have the right to install such a service.
        </p>

        <p class="para">
            Here are some example use cases, for which <span class="classname">Zend_TimeSync</span> is
            perfect suited:
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">
                    <em class="emphasis">Server without time service</em>
                </p>

                <p class="para">
                    If your application is running on a server and this server does not have any
                    time service running, it may make sense to use
                    <span class="classname">Zend_TimeSync</span> in your application.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">Separate database server</em>
                </p>

                <p class="para">
                    If your database is running on a different server and this server is not
                    connected with <em class="emphasis">NTP</em> or <em class="emphasis">SNTP</em>
                    to the application server, you might have problems using storing and using time
                    stamp data.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">Multiple servers</em>
                </p>

                <p class="para">
                    If your application is running on more than one server and these servers&#039; time
                    bases are not syncronized, you can expect problems within your application when
                    part of the application is coming from one server and another part from another
                    server.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">Batch processing</em>
                </p>

                <p class="para">
                    If you want to work with a time service within a batch file or within a
                    command line application, <span class="classname">Zend_TimeSync</span> may be of use.
                </p>
            </li>
        </ul>

        <p class="para">
            <span class="classname">Zend_TimeSync</span> may provide a good solution in all of these cases
            and can be used if you are unable to run any services on your server.
        </p>
    </div>

    <div class="section" id="zend.timesync.introduction.ntp"><div class="info"><h1 class="title">What is NTP ?</h1></div>
        

        <p class="para">
            The Network Time Protocol (<em class="emphasis">NTP</em>) is a protocol
            for synchronizing multiple systems&#039; clocks over packet-switched, variable-latency data
            networks. NTP uses UDP port 123 as its transport layer. See the <a href="http://en.wikipedia.org/wiki/Network_Time_Protocol" class="link external">&raquo; wikipedia article</a>
            for details about this protocol.
        </p>
    </div>

    <div class="section" id="zend.timesync.introduction.sntp"><div class="info"><h1 class="title">What is SNTP?</h1></div>
        

        <p class="para">
            The Simple Network Time Protocol (<em class="emphasis">SNTP</em>) is a
            protocol synchronizing multiple systems&#039; clocks over packet-switched, variable-latency
            data networks. SNTP uses UDP port 37 as its transport layer. It is closely related to
            the Network Time Protocol, but simpler.
        </p>
    </div>

    <div class="section" id="zend.timesync.introduction.problematic"><div class="info"><h1 class="title">Problematic usage</h1></div>
        

        <p class="para">
            Be warned that when you are using <span class="classname">Zend_TimeSync</span> you will have to
            think about some details related to the structure of time sync and the internet itself.
            Correct usage and best practices will be described here. Read carefully before you begin
            using <span class="classname">Zend_TimeSync</span>.
        </p>
    </div>

    <div class="section" id="zend.timesync.introduction.decision"><div class="info"><h1 class="title">Decide which server to use</h1></div>
        

        <p class="para">
            You should select the time server that you want to use very carefully according to the
            following criteria:
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">
                    Distance
                </p>

                <p class="para">
                    The distance from your application server to the time server. If your server is
                    in Europe, it would make little sense to select a time server in Tahiti. Always
                    select a server which is not far away. This reduces the request time and overall
                    network load.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    Speed
                </p>

                <p class="para">
                    How long it takes to receive the request is also relevant. Try different servers
                    to get the best result. If you are requesting a server which is never
                    accessible, you will always have an unnecessary delay.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    Splitting
                </p>

                <p class="para">
                    Do not always use the same server. All time servers will lock out requests from
                    servers that are flooding the server. If your application requires heavy use of
                    time servers, you should consider one of the pools described later.
                </p>
            </li>
        </ul>

        <p class="para">
            So where can you find a time server? Generally you can use any timeserver you can
            connect to. This can be a time server within your LAN or any public time server you have
            access to. If you decide to use a public time server, you should consider using a server
            pool. Server pools are public addresses from which you will get a random, pooled time
            server by requesting the time. This way you will not have to split your requests. There
            are public server pools available for many regions which you may use to avoid problems
            mentioned above.
        </p>

        <p class="para">
            See <a href="http://www.pool.ntp.org" class="link external">&raquo; pool.ntp.org</a> to find your nearest
            server pool. For example, if your server is located within Germany you can connect to
            <em class="emphasis">0.europe.pool.ntp.org</em>.
        </p>
    </div>
</div>
        <hr />

            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="zend.timesync.html">Zend_TimeSync</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="zend.timesync.html">Zend_TimeSync</a></span><br />
                        <span class="home"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="zend.timesync.working.html">Working with Zend_TimeSync</a></div>
                    </td>
                </tr>
            </table>
</td>
        <td style="font-size: smaller;" width="15%"> <style type="text/css">
#leftbar {
	float: left;
	width: 186px;
	padding: 5px;
	font-size: smaller;
}
ul.toc {
	margin: 0px 5px 5px 5px;
	padding: 0px;
}
ul.toc li {
	font-size: 85%;
	margin: 1px 0 1px 1px;
	padding: 1px 0 1px 11px;
	list-style-type: none;
	background-repeat: no-repeat;
	background-position: center left;
}
ul.toc li.header {
	font-size: 115%;
	padding: 5px 0px 5px 11px;
	border-bottom: 1px solid #cccccc;
	margin-bottom: 5px;
}
ul.toc li.active {
	font-weight: bold;
}
ul.toc li a {
	text-decoration: none;
}
ul.toc li a:hover {
	text-decoration: underline;
}
</style>
 <ul class="toc">
  <li class="header home"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></li>
  <li class="header up"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></li>
  <li class="header up"><a href="reference.html">Refer&ecirc;ncia do Zend Framework</a></li>
  <li class="header up"><a href="zend.timesync.html">Zend_TimeSync</a></li>
  <li class="active"><a href="zend.timesync.introduction.html">Introduction</a></li>
  <li><a href="zend.timesync.working.html">Working with Zend_TimeSync</a></li>
 </ul>
 </td>
    </tr>
</table>

<script type="text/javascript" src="../js/shCore.js"></script>
<script type="text/javascript" src="../js/shAutoloader.js"></script>
<script type="text/javascript" src="../js/main.js"></script>

</body>
</html>